﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Mbr.Reviews.Core.Contracts;
using Mbr.Reviews.Core.Contracts.DTO;
using DTO = Mbr.Reviews.Core.Contracts.DTO;

namespace Mbr.Reviews.Core.ProductStores
{
    public class InMemoryProductStore : IStoreProducts
    {
        private List<DTO.Product> products = new List<DTO.Product>();

        public IEnumerable<DTO.Product> Find(params string[] keywords)
        {
            return products.Where(p => p.IsMatch(keywords)).ToArray();
        }

        public void Store(DTO.Product product)
        {
            products.Add(product);
        }
    }
}
